//
//  AttackAllTopicTableViewCell.m
//  GiftNote
//
//  Created by wsh on 15/8/15.
//  Copyright (c) 2015年 GN. All rights reserved.
//

#import "AttackAllTopicTableViewCell.h"
#import "Screen.h"
#import "UIImageView+WebCache.h"

@implementation AttackAllTopicTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _mainImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, (SCREEN_WIDTH - 20) / 2.0)];
        
        _mainImageView.layer.masksToBounds = YES;
        _mainImageView.layer.cornerRadius = 5;
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, (SCREEN_WIDTH - 20) / 4.0 - 31, SCREEN_WIDTH - 20, 20)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        
        _subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, (SCREEN_WIDTH - 20) / 4.0 + 10, SCREEN_WIDTH - 20, 30)];
        _subtitleLabel.textAlignment = NSTextAlignmentCenter;
        
        _firstLine = [[UIImageView alloc] initWithFrame:CGRectMake(30, (SCREEN_WIDTH - 20) / 4.0 , (SCREEN_WIDTH - 20) / 2.0 - 32, 2)];
        _firstLine.backgroundColor = [UIColor blackColor];
        
        _secondLine = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 20) / 2.0 + 31, (SCREEN_WIDTH - 20) / 4.0 , (SCREEN_WIDTH - 20) / 2.0 - 32, 2)];
        _secondLine.backgroundColor = [UIColor blackColor];

        
        _thirdPoint = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 20) / 2.0 + 10 , (SCREEN_WIDTH - 20) / 4.0 , 8, 2)];
        _thirdPoint.backgroundColor = [UIColor blackColor];
        
        [self.contentView addSubview:_mainImageView];
        [self.contentView addSubview:_titleLabel];
        [self.contentView addSubview:_subtitleLabel];
        [self.contentView addSubview:_firstLine];
        [self.contentView addSubview:_secondLine];
        [self.contentView addSubview:_thirdPoint];
    }
    return self;
}




- (void)setModel:(AttackHeaderModel *)model{
    _model = model;
    
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url] placeholderImage:[UIImage imageNamed:@"placeHolder"]];
    _titleLabel.text = model.title;
    _subtitleLabel.text = model.subtitle;
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
